package de.tudarmstadt.gdi1.project.cipher.substitution.monoalphabetic;

import de.tudarmstadt.gdi1.project.alphabet.Alphabet;
import de.tudarmstadt.gdi1.project.cipher.substitution.SubstitutionCipher_IMP;

/**
 * @author Samir
 * 
 * 
 * A marker interface for an implementation of a monoalphabetic cipher
 * @param <alphabet>
 */
public class MonoalphabeticCipher_IMP extends SubstitutionCipher_IMP implements MonoalphabeticCipher  {

	/**
	 * @param src
	 * 				sourcealphabet, das Alphabet, welches in der Regel gilt übersetzt zu werden
	 * 
	 * @param dest
	 * 				destinealphabet, das Paralellalphabet 
	 * 
	 * 
	 */
	
	Alphabet src;
	Alphabet dest;
	
	
	
	public MonoalphabeticCipher_IMP(Alphabet source, Alphabet desti) {
					
		this.src = source;
		this.dest= desti;
					
					
				}
	
	
	/**
	 * Translates the given character that is on the given position in the text
	 * into its encrypted equivalent.
	 * 
	 * @param chr
	 *            the character that needs to be translated
	 * @param i
	 *            the position the character stands in the text
	 * @return the translated/encrypted character
	 */
	public final char translate(char chr, int i) {
		

			return dest.getChar(src.getIndex(chr));
		
	}
/**
 * translates the given character that is on the given position in the text
 * back into its decrypted equivalent
 * 
 * @param chr
 *            the character that needs to be reversetranslated
 * @param i
 *            the position of the character in the text
 * @return the reversetranslated/decrypted character
 */
public final char reverseTranslate(char chr, int i) {


	
	return src.getChar(dest.getIndex(chr)); }
	




}
		




	


